1 module unde.games.dizzy.omega.animations.drop; 2 3 import derelict.opengl3.gl; 4 import std.math; 5 import unde.games.object; 6 import unde.games.renderer; 7 import unde.global_state; 8 9 class Drop:StaticGameObject 10 { 11 float y1, y2, y3; 12 int offset; 13 14 this(MainGameObject root, float x, float y1, float y2, float y3, float z, int offset) 15 { 16 this.x = x; 17 this.y1 = y1; 18 this.y2 = y2; 19 this.y3 = y3; 20 this.z = z; 21 this.offset = offset; 22 23 models["drop"] = root.models["drop"]; 24 super(root); 25 } 26 27 override void draw(GlobalState gs) 28 { 29 if (abs(root.scrx-x) > 32.0 || 30 abs(root.scry-y) > 18.0) return; 31 32 float f = (root.frame+offset)%500; 33 34 glPushMatrix(); 35 if (f <= 0.0) {} 36 else if (f <= 300.0) 37 { 38 glTranslatef(x, y1 - (y1-y2)*f/300.0, z); 39 recursive_render(gs, models["drop"]); 40 } 41 else if (f <= 400.0) 42 { 43 glTranslatef(x, y2 - (y2-y3)*(f-300.0)/100.0, z); 44 recursive_render(gs, models["drop"]); 45 } 46 else {} 47 glPopMatrix(); 48 } 49 50 override bool tick(GlobalState gs) 51 { 52 return true; 53 } 54 } 55